package com.um.pasantiaum.empresa.pedidos;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.um.pasantiaum.R;
import com.um.pasantiaum.objetos.Pedido;
import com.um.pasantiaum.objetos.SelectedPedido;

public class DetailPedidoTruckActivity extends Activity {
	
	final Context context = this;
	private Pedido selectedOrder;
	private TextView mDate, mUserName, mProducts, mTotal;
	private Button mAceptar, mRechazar, mVerCamion;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_detail_pedido);
		selectedOrder = SelectedPedido.getSelectedPedido().getPedido();

		mDate = (TextView) findViewById(R.id.producto_date_detail);
		mDate.setText(selectedOrder.getDateCreated().toString());

		mUserName = (TextView) findViewById(R.id.prodructo_nombre_detail);
		mUserName.setText(selectedOrder.getCliente().getName());

		mProducts = (TextView) findViewById(R.id.producto_descripcion_detail);
		mProducts.setText(selectedOrder.getProductos());

		mTotal = (TextView) findViewById(R.id.producto_precio_detail);
		mTotal.setText("$ " + String.valueOf(selectedOrder.getPrecioTotal()));

		mAceptar = (Button) findViewById(R.id.aceptar_button_detail);
		mAceptar.setVisibility(View.INVISIBLE);
		
		mRechazar = (Button) findViewById(R.id.rechazar_button_detail);
		mRechazar.setVisibility(View.INVISIBLE);
		
		mVerCamion = (Button) findViewById(R.id.ver_camion_button_detail);
		mVerCamion.setText("Asignar camion");
		mVerCamion.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				Intent i = new Intent(DetailPedidoTruckActivity.this, SelectTruckActivity.class);
				startActivity(i);
				
			}
		});

	}

}
